Harden client-side rendering and build inputs#83
Conversation
Build command result rows with DOM nodes so search titles and excerpts are inserted as text instead of interpolated into innerHTML. Keep icon rendering unchanged because those strings are defined in-repo, and add a regression test that proves HTML in search results is displayed as text rather than creating DOM nodes.
Replace runtime Font Awesome injection in each layout with a fixed CDN stylesheet reference protected by SRI. This removes the hostname-based script/css branching, avoids loading a kit script into the page head, and keeps icon rendering consistent across local and deployed pages.
Sanitize cloned featured-paper elements before inserting them into the homepage card list. Rebuild iframe-only media as trusted YouTube nocookie embeds with explicit sandbox and referrer policy settings, and add coverage for both the preserved safe embed path and rejected untrusted iframe sources.
Stop bootstrap-by-download behavior in setup.sh when Ruby or Node.js are missing, pin the remaining GitHub App token action by commit SHA, and switch SEO config loading to YAML.safe_load. Also normalize internal SEO output paths through URI parsing and cleanpath checks before writing under _site so crafted URLs cannot escape the build output directory.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87bb1a290f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR hardens the site’s client-side rendering and build-time inputs by reducing HTML injection surfaces, tightening iframe/embed handling, and improving supply-chain pinning for external dependencies and GitHub Actions.
Changes:
- Render command palette result titles/excerpts via DOM text nodes (avoids
innerHTMLfor untrusted fields) and add regression coverage. - Sanitize featured paper card content and only recreate trusted YouTube nocookie iframes with sandboxing; add regression coverage for untrusted iframe sources.
- Harden setup/SEO tooling and dependency inputs (safe YAML load + URL/path normalization, stop auto-install-by-download, pin GitHub Action, replace runtime Font Awesome injection with pinned stylesheet + SRI).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
assets/js/command-palette.js |
Uses DOM nodes + textContent for result title/excerpt rendering. |
assets/js/main.js |
Sanitizes featured-paper clones; recreates only trusted YouTube nocookie iframes with security attributes. |
scripts/generate_seo_tags.rb |
Uses safe YAML loading; strengthens URL parsing/normalization and prevents unsafe output paths. |
scripts/setup.sh |
Stops auto-installing Ruby/Node via downloaded installers; requires trusted pre-install. |
tests/command-palette-stale-search.test.js |
Adds XSS regression test ensuring title/excerpt render as text. |
tests/featured-papers-regression.test.js |
Extends featured-paper tests for iframe sanitization and untrusted iframe dropping. |
.github/workflows/sync-org-profile-publications.yml |
Pins actions/create-github-app-token to a specific commit SHA. |
_layouts/default.html |
Replaces runtime Font Awesome injection with pinned CDN stylesheet + SRI. |
_layouts/history.html |
Replaces runtime Font Awesome injection with pinned CDN stylesheet + SRI. |
_layouts/join-us.html |
Replaces runtime Font Awesome injection with pinned CDN stylesheet + SRI. |
_layouts/research.html |
Replaces runtime Font Awesome injection with pinned CDN stylesheet + SRI. |
_layouts/team.html |
Replaces runtime Font Awesome injection with pinned CDN stylesheet + SRI. |
_layouts/teaching.html |
Replaces runtime Font Awesome injection with pinned CDN stylesheet + SRI. |
_layouts/teaching-course.html |
Escapes head metadata, switches JSON-LD fields to jsonify, and replaces Font Awesome injection with pinned CDN stylesheet + SRI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace inherited featured iframe permissions with a fixed allowlist and stronger sandboxing. Also let setup.sh bootstrap the repo-pinned Ruby through rbenv even when ruby is not initially on PATH, matching the script's documented behavior.
Fix the still-relevant stale findings in the current tree: protect command-palette external links with noopener, build the research tag filter with DOM nodes instead of HTML string interpolation, stop reparsing research badge paragraph content through innerHTML, replace the remaining Dropbox-hosted research image with a local asset, and repair fix-quotes.sh so it no longer risks emptying files when run.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
innerHTMLteaching-coursehead metadata/JSON-LDContext
These changes come from reviewing older security-scan patches against current
main. I applied the ones that still made sense, adapted the featured-iframe fix so it keeps safe embeds working, and confirmedupdate-search.ymlwas already pinned before this branch.Testing
npx eslint assets/js/command-palette.js assets/js/main.jsnpx jest tests/command-palette-stale-search.test.js tests/featured-papers-regression.test.js --runInBand --coverage=falsebash -n scripts/setup.shruby -c scripts/generate_seo_tags.rb